package com.home.retrofit

import com.home.retrofit.bean.ElevatorListReturnBean
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response

//Kotlin
fun main() {
    val token = "app_login_tokens:903958d023204bfa97aac586e03250db"
    //login
    /*WXXWRetrofitUtil.getWXXWApi().login(
        WXXWRetrofitUtil.str2RequestBody("{\n" +
            "    \"phoneNumber\": \"15895308776\",\n" +
            "    \"passWord\": \"123456\"\n" +
            "}")
    ).enqueue(
        object : Callback<LoginReturnBean> {
            override fun onResponse(
                call: Call<LoginReturnBean>,
                response: Response<LoginReturnBean>
            ) {
                println(response.toString())
            }

            override fun onFailure(
                call: Call<LoginReturnBean>,
                t: Throwable
            ) {
                println("onFail:${t.message}")
            }
        }
    )*/

    //loginout
    /*WXXWRetrofitUtil.getWXXWApi().logout(token).enqueue(
        object : Callback<LoginReturnBean> {
            override fun onResponse(
                call: Call<LoginReturnBean>,
                response: Response<LoginReturnBean>
            ) {
                println(response.body()?.code)
                println(response.body()?.msg)
                println(response.body()?.content)
            }

            override fun onFailure(
                call: Call<LoginReturnBean>,
                t: Throwable
            ) {
                println("onFail:${t.message}")
            }
        }
    )*/

    //elevatorList
    WXXWRetrofitUtil.getWXXWApi().elevatorList(token).enqueue(
        object : Callback<ElevatorListReturnBean> {
            override fun onResponse(
                call: Call<ElevatorListReturnBean>,
                response: Response<ElevatorListReturnBean>
            ) {
            }

            override fun onFailure(
                call: Call<ElevatorListReturnBean>,
                t: Throwable
            ) {
            }
        }
    )
}
